﻿<UserControl x:Class="Samba.Modules.SettingsModule.SettingsView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:Common="clr-namespace:Samba.Presentation.Common;assembly=Samba.Presentation.Common"
     mc:Ignorable="d">
    <ScrollViewer Common:KineticBehaviour.HandleKineticScrolling="True" VerticalScrollBarVisibility="Auto">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*"/>
                <RowDefinition Height="auto"/>
            </Grid.RowDefinitions>
            <TabControl>
                <TabItem>
                    <TabItem.Header>
                        <LocText ResourceIdentifierKey="LocalSettings"/>
                    </TabItem.Header>
                    <StackPanel>
                        <Label>
                            <LocText ResourceIdentifierKey="TerminalName" Suffix=":"/>
                        </Label>
                        <ComboBox HorizontalAlignment="Left" Width="200" ItemsSource="{Binding TerminalNames}"
                     Text="{Binding TerminalName}" />

                        <Label>
                            <LocText ResourceIdentifierKey="DataConnection" Suffix=":"/>
                        </Label>
                        <TextBox HorizontalAlignment="Left" MinWidth="300" Text="{Binding ConnectionString}" />
                        <Label>
                            <LocText ResourceIdentifierKey="MessageServerName" Suffix=":"/>
                        </Label>
                        <TextBox HorizontalAlignment="Left" MinWidth="200" Text="{Binding MessagingServerName}" />
                        <Label>
                            <LocText ResourceIdentifierKey="MessageServerPort" Suffix=":"/>
                        </Label>
                        <TextBox HorizontalAlignment="Left" MinWidth="100" Text="{Binding MessagingServerPort}" />
                        <CheckBox Margin="0,5" IsChecked="{Binding StartMessagingClient}" Content="{LocText AutoStartMessageClient}" />
                        <Button HorizontalAlignment="Left" Margin="0,10" Content="{Binding StartMessagingServerCommand.Caption}" Command="{Binding StartMessagingServerCommand}" />
                        <StackPanel Visibility="{Binding IsCreditCardProcessorEditorVisible,Converter={StaticResource VisibilityConverter}}">
                            <Label>
                                Credit Card Processor:
                            </Label>
                            <StackPanel Orientation="Horizontal">
                                <ComboBox IsEditable="True" HorizontalAlignment="Left" Width="200" ItemsSource="{Binding CreditCardProcessorNames}"
                                    Text="{Binding DefaultCreditCardProcessorName}" />
                                <Button Margin="5,0" Command="{Binding EditCreditCardProcessorSettings}" Content="{Binding EditCreditCardProcessorSettings.Caption}"/>
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </TabItem>
                <TabItem>
                    <TabItem.Header>
                        <LocText ResourceIdentifierKey="ProgramLanguage"/>
                    </TabItem.Header>

                    <StackPanel HorizontalAlignment="Left" Margin="3">
                        <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0,5">
                            <Label>
                                <LocText ResourceIdentifierKey="UiLanguage" Suffix=":"/>
                            </Label>
                            <ComboBox HorizontalAlignment="Left" Width="100" SelectedValue="{Binding Language}"
                     DisplayMemberPath="NativeName" SelectedValuePath="Name" ItemsSource="{Binding SupportedLanguages}" />
                        </StackPanel>
                        <CheckBox Margin="0" IsEnabled="{Binding OverrideLanguage}" IsChecked="{Binding OverrideWindowsRegionalSettings}">
                            <LocText ResourceIdentifierKey="OverrideWindowsRegionalSettings"/>
                        </CheckBox>

                        <Label>Major Currency Name:</Label>
                        <TextBox HorizontalAlignment="Left" MinWidth="150" Text="{Binding MajorCurrencyName}"></TextBox>
                        <Label>Minor Currency Name:</Label>
                        <TextBox HorizontalAlignment="Left" MinWidth="150" Text="{Binding MinorCurrencyName}"></TextBox>
                        <Label>Plural Currency Suffix:</Label>
                        <TextBox HorizontalAlignment="Left" MinWidth="50" Text="{Binding PluralCurrencySuffix}"></TextBox>
                    </StackPanel>


                </TabItem>
            </TabControl>
            <StackPanel  Grid.Row="1" Orientation="Horizontal">
                <Button HorizontalAlignment="Left" Margin="0,10,20,10" MinWidth="70" Content="{Binding SaveSettingsCommand.Caption}"
                     Command="{Binding SaveSettingsCommand}" />
                <Button HorizontalAlignment="Left" Margin="2,10" Content="{Binding DisplayCommonAppPathCommand.Caption}"
                     Command="{Binding DisplayCommonAppPathCommand}" />
                <Button HorizontalAlignment="Left" Margin="2,10" Content="{Binding DisplayUserAppPathCommand.Caption}"
                     Command="{Binding DisplayUserAppPathCommand}" />
            </StackPanel>
        </Grid>
    </ScrollViewer>
</UserControl>